#ifndef HISTREAMER_PLUGIN_COMMON_CAPS_H
#define HISTREAMER_PLUGIN_COMMON_CAPS_H

#include <utility>
#include <vector>
#include "plugin_tags.h"

namespace OHOS {
namespace Multimedia {
namespace Plugin {

template<typename T> using FixedCapability = T;

template<typename T> using DiscreteCapability = std::pair<T,T>;

template<typename T> using DiscreteCapability = std::vector<T>;

struct Capability{
	enum struct Key : uint32_t{
		AUDIO_SAMPLE_RATE = static_cast<uint32_t>(Tag::AUDIO_SAMPLE_RATE),
		AUDIO_CHANNELS = static_cast<uint32_t>(Tag::AUDIO_CHANNELS),
		AUDIO_CHANNEL_LAYOUT = static_cast<uint32_t>(Tag::AUDIO_CHANNEL_LAYOUT),
		AUDIO_SAMPLE_FORMAT = static_cast<uint32_t>(Tag::AUDIO_CHANNEL_LAYOUT),
		AUDIO_MPEG_VERSION = static_cast<uint32_t>(Tag::AUDIO_MPEG_VERSION),
		AUDIO_MPEG_LAYER = static_cast<uint32_t>(Tag::AUDIO_MPEG_LAYER),
		AUDIO_AAC_PROFILE = static_cast<uint32_t>(Tag::AUDIO_AAC_PROFILE),
		AUDIO_AAC_LEVEL = static_cast<uint32_t>(Tag::AUDIO_AAC_LEVEL),
		AUDIO_AAC_STREAM_FORMAT = static_cast<uint32_t>(Tag::AUDIO_AAC_STREAM_FORMAT),
	};
	using KeyMap = std::map<Key,ValueType>;
	Capability() = default;
	explicit Capability(std::string m):mine(std::move(m)){}

	template<typename T>
	Capability& AppendFixedKey(Key key, const T& val)
	{
		key[Key] = val;
		return *this;
	}

	template<typename T>
	Capability& AppendIntervalKey(Key key, const T& rangeStart, const T& rangeEnd)
	{
		key[Key] = std::make_pair(rangeStart, rangeEnd);
		return *this;
	}

	template<typename T>
	Capability& AppendDiscreteKey(Key key, DiscreteCapability<T>, discreteValues)
	{
		key[Key] = std::move(discreteValues);
		return *this;
	}

	Capability& SetMine(std::string val)
	{
		mine= std::move(val);
		return *this;
	}

	std::string mine;
	KeyMap key;
};

using CapabilitySet = std::vector<Capability>;

}
}
}
#endif

